gsk: Add debug category for fallbacks
authorBenjamin Otte <otte@redhat.com>
Fri, 23 Dec 2016 23:52:07 +0000 (00:52 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 24 Dec 2016 05:19:16 +0000 (06:19 +0100)
... and use it for the cases in Vulkan where we fall back to Cairo.

gsk/gskdebug.c
gsk/gskdebugprivate.h
gsk/gskvulkanrenderpass.c

index 7ee7a7b85928c9142cbdf8c5edb82767b7015ff2..3ccb5e0400ae622ce2a1a41212df02624fb3c08a 100644 (file)
@@ -9,7 +9,8 @@ static const GDebugKey gsk_debug_keys[] = {
   { "shaders", GSK_DEBUG_SHADERS },
   { "transforms", GSK_DEBUG_TRANSFORMS },
   { "surface", GSK_DEBUG_SURFACE },
-  { "vulkan", GSK_DEBUG_VULKAN }
+  { "vulkan", GSK_DEBUG_VULKAN },
+  { "fallback", GSK_DEBUG_FALLBACK }
 };
 #endif
 
index 6f5d64ed9af4d06e76f99cb4622fe04dec6e1349..26b24f7e44edd145f06a3665b0611614e9eb750e 100644 (file)
@@ -13,7 +13,8 @@ typedef enum {
   GSK_DEBUG_SHADERS     = 1 << 4,
   GSK_DEBUG_TRANSFORMS  = 1 << 5,
   GSK_DEBUG_SURFACE     = 1 << 6,
-  GSK_DEBUG_VULKAN      = 1 << 7
+  GSK_DEBUG_VULKAN      = 1 << 7,
+  GSK_DEBUG_FALLBACK    = 1 << 8
 } GskDebugFlags;
 
 typedef enum {
index a7ba94d0c0b651e2469ce6e709a256bda2378576..8a74cf754dd7d5cfb7d4bedb85470a85bc759e30 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "gskvulkanrenderpassprivate.h"
 
+#include "gskdebugprivate.h"
 #include "gskrendernodeprivate.h"
 #include "gskrenderer.h"
 #include "gskroundedrectprivate.h"
@@ -82,6 +83,11 @@ gsk_vulkan_render_pass_free (GskVulkanRenderPass *self)
   g_slice_free (GskVulkanRenderPass, self);
 }
 
+#define FALLBACK(...) G_STMT_START { \
+  GSK_NOTE (FALLBACK, g_print (__VA_ARGS__)); \
+  goto fallback; \
+}G_STMT_END
+
 void
 gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
                                  GskVulkanRender               *render,
@@ -100,13 +106,13 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
       g_assert_not_reached ();
       return;
     default:
-      goto fallback;
+      FALLBACK ("Unsupported node '%s'\n", node->node_class->type_name);
 
     case GSK_CAIRO_NODE:
       if (gsk_cairo_node_get_surface (node) == NULL)
         return;
       if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-        goto fallback;
+        FALLBACK ("Cairo nodes can't deal with clip type %u\n", clip->type);
       op.type = GSK_VULKAN_OP_SURFACE;
       op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
       g_array_append_val (self->render_ops, op);
@@ -114,7 +120,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
 
     case GSK_TEXTURE_NODE:
       if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-        goto fallback;
+        FALLBACK ("Texture nodes can't deal with clip type %u\n", clip->type);
       op.type = GSK_VULKAN_OP_TEXTURE;
       op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
       g_array_append_val (self->render_ops, op);
@@ -122,7 +128,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
 
     case GSK_COLOR_NODE:
       if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-        goto fallback;
+        FALLBACK ("Color nodes can't deal with clip type %u\n", clip->type);
       op.type = GSK_VULKAN_OP_COLOR;
       op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_COLOR);
       g_array_append_val (self->render_ops, op);
@@ -146,7 +152,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
         graphene_rect_t rect;
 
         if (!gsk_vulkan_clip_contains_rect (clip, &node->bounds))
-          goto fallback;
+          FALLBACK ("Transform nodes can't deal with clip type %u\n", clip->type);
 
         gsk_transform_node_get_transform (node, &transform);
         op.type = GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS;
@@ -168,7 +174,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
         GskVulkanClip new_clip;
 
         if (!gsk_vulkan_clip_intersect_rect (&new_clip, clip, gsk_clip_node_peek_clip (node)))
-          goto fallback;
+          FALLBACK ("Failed to find intersection between clip of type %u and rectangle\n", clip->type);
         if (new_clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
           return;
 
@@ -181,7 +187,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
         GskVulkanClip new_clip;
 
         if (!gsk_vulkan_clip_intersect_rounded_rect (&new_clip, clip, gsk_rounded_clip_node_peek_clip (node)))
-          goto fallback;
+          FALLBACK ("Failed to find intersection between clip of type %u and rounded rectangle\n", clip->type);
         if (new_clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
           return;
 
@@ -216,6 +222,7 @@ fallback:
   op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
   g_array_append_val (self->render_ops, op);
 }
+#undef FALLBACK
 
 void
 gsk_vulkan_render_pass_add (GskVulkanRenderPass     *self,